package com.itheima.day07;

/*
定义一个时钟(Clock)类，描述三个属性 时、分秒：
​		提供空参构造；
​		提供带参构造；
​		提供setter/getter方法；
 */
public class Clock06 {

    private int hour;
    private int minute;
    private int second;


    public Clock06() {

    }

    public Clock06(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        if(hour>=24 || hour <0){
            System.out.println("请正确输入时刻!!");
        }else{
            this.hour = hour;
        }

    }

    public int getMinute() {
        return minute;
    }

    public void setMinute(int minute) {
        if(minute>=60 || minute <0){
            System.out.println("请正确输入分钟!!");
        }else{
            this.minute = minute;
        }


    }

    public int getSecond() {
        return second;
    }

    public void setSecond(int second) {
        if(second>=60 || second <0){
            System.out.println("请正确输入秒数!!");
        }else{
            this.second = second;
        }

    }

    public void showTime(){
        System.out.println("现在是北京时间:"+hour
                +"时"+minute+"分"+second+"秒");
    }

}
